import time
import threading
import sys


def singing():
    for i in range(5):
        print(f"唱歌ing {i}")
        time.sleep(1)


def dancing():
    for i in range(5):
        print(f"跳舞ing {i}")
        time.sleep(1)        
        
if __name__ == '__main__' :
    
    #创建线程对象，指定线程函数的入口地址，返回线程对象
    t1 = threading.Thread(target=singing, daemon=True)
    t2 = threading.Thread(target=dancing, daemon=True)

    #线程启动
    t1.start()
    t2.start()

    time.sleep(3)
    print("主线程结束")
    sys.exit(0)